if [ ! $1 ] 
then
  echo "***********    【未输入参数1】    *****************"
  echo "**********  wh: coding-everyday  *****************"
  echo "**********  tmp: tmp             *****************"
  echo "**********  p: everyday编程题     *****************"
  echo "**********  c: c-cpp             *****************"
  echo "**********  l: Linux_learn       *****************"
  exit;
fi

if [ ! $2 ]
then
  echo "******  【未输入参数2: commit信息】  **************"
  exit;
fi

echo -e ""
case "$1" in
  "wh")
  echo -e "Add and Commit coding-everyday\n"
  path="/root/coding-everyday"
  ;;
  "tmp")
  echo -e "Add and Commit coding-everyday/tmp\n"
  path="/root/coding-everyday/tmp"
  ;;
  "p")
  echo -e "Add and Commit coding-everyday/everyday编程题\n"
  path="/root/coding-everyday/everyday编程题"
  ;;
  "c")
  echo -e "Add and Commit coding-everyday/c-cpp\n"
  path="/root/coding-everyday/c-cpp"
  ;;
  "l")
  echo -e "Add and Commit coding-everyday/Linux_learn\n"
  path="/root/coding-everyday/Linux_learn"
  ;;
  "class")
  echo -e "Add and Commit coding-everyday/awesome_cs_classes\n"
  path="/root/coding-everyday/awesome_cs_classes"
  ;;
esac
 
cd $path
echo "*********【进入当前项目】*************"
 
pwd
ls -l
 
echo -e "\n*********【开始执行命令】*************"

git pull 

git add . --all

git status
 
sleep 1s
 
echo -e "\n********** 【add 成功】 *************"

git commit -m "$2" -a
 
echo -e "\n********* 【commit 成功】 ***********"
 
sleep 1s
 
 
# if [ ! $3 ]
# then
#   echo "####### 请输入自己提交代码的分支 #######"
#   exit;
# fi
  
# git push origin "$3"

git config --global push.default matching

git push
 
echo -e "\n********* 【push 成功】 ***********"